package 原型模式;

public class Sheep implements Cloneable{
	private String name;
	private int age;
	public Sheep(String name, int age) {
		super();
		this.setName(name);
		this.setAge(age);
	}
	
	// 右击选择 source的选项生成
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	
	@Override
	public String toString() {
		return "Sheep [name=" + name + ", age=" + age + "]";
	}
	

	@Override
	protected Object clone(){
		// TODO Auto-generated method stub
		Sheep sheep = null;
		try {
			sheep = (Sheep)super.clone();
		} catch (Exception e) {
			// TODO: handle exception
			System.out.println(e.getMessage());
		}
		
		return sheep;
	}

}
